Skip to main content

Symbolic Computation

Symbols can be used along with TeX for writing formulas and calculating them.

The first step is to declare a variable as a Symbol:

let x = sym('x')

Then write an expression using that symbol:

let fx = (x^3) + sin(x)

You can output the formula:

formulaTex `f(x)= ${fx}`

Here is an example of performing calculations on the formula:

  • Finding a derivative:
formulaTex`f'(x) = ${diff(fx, x)}` 
  • Calculating an integral:
formulaTex`\int{f(x)dx} = ${integrate(fx, x)}`

 

Here's an example with several types of calculations: